import request from "@/utils/request";
import qs from "qs";

// 查询数据类别列表
export function listType(query) {
  return request({
    url: "/system/b/datatype/queryTreeList",
    method: "get",
    params: query,
  });
}

// 查询数据类别列表
export function queryDataTypeList(query) {
  return request({
    url: "/system/b/datatype/queryList",
    method: "get",
    params: query,
  });
}

// 查询数据类别详细
export function getType(typeId) {
  return request({
    url: "/system/b/datatype/query",
    method: "get",
    params: typeId,
  });
}

// 查询敏感字段表列表
export function queryListForType(params) {
  return request({
    url: "/system/b/datasensitivewords/queryListForType",
    method: "get",
    params,
  });
}

// 绑定敏感字段
export function datatypewordrel(data) {
  return request({
    url: "/system/b/datatypewordrel/add",
    method: "post",
    headers: {
      "Content-Type": "application/x-www-form-urlencoded;charset=UTF-8",
    },
    data: qs.stringify(data),
  });
}

// 新增数据类别
export function addType(data) {
  return request({
    url: "/system/b/datatype/add",
    method: "post",
    headers: {
      "Content-Type": "application/x-www-form-urlencoded;charset=UTF-8",
    },
    data: qs.stringify(data),
  });
}

// 编辑数据类别
export function updateType(data) {
  return request({
    url: "/system/b/datatype/update",
    method: "post",
    headers: {
      "Content-Type": "application/x-www-form-urlencoded;charset=UTF-8",
    },
    data: qs.stringify(data),
  });
}

// 删除数据类别
export function delType(data) {
  return request({
    url: "/system/b/datatype/delete",
    method: "post",
    headers: {
      "Content-Type": "application/x-www-form-urlencoded;charset=UTF-8",
    },
    data: qs.stringify(data),
  });
}

// 删除数据前校验
export function deleteForCheck(data) {
  return request({
    url: "/system/b/datatype/deleteCheck",
    method: "post",
    headers: {
      "Content-Type": "application/x-www-form-urlencoded;charset=UTF-8",
    },
    data: qs.stringify(data),
  });
}

export function relation(data) {
  return request({
    url: "/system/b/datatype/relation",
    method: "post",
    data: data,
  });
}
